package cn.zyx.Config;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * @author zzp
 * @since 2021/12/18 18:39
 */


@Component
@PropertySource(value = {"classpath:wx.properties"})
public class WeixinPayProperties implements InitializingBean {

    // 微信支付网关
    @Value("${weixin.pay.info.gateway}")
    private String gateway;
    //小程序APPID
    @Value("${weixin.pay.info.appid}")
    private String appid;
    @Value("${weixin.pay.info.type}")
    private String type;
    //小程序APPSceret
    @Value("${weixin.pay.info.appsecret}")
    private String appsecret;
    //商户ID
    @Value("${weixin.pay.info.mchid}")
    private String mchid;
    //回调地址
    @Value("${weixin.pay.info.notifyPath}")
    private String notifyPath;
    public static String WX_GATEWAY;
    public static String WX_APPID;
    public static String WX_TYPE;
    public static String WX_APPSECRET;
    public static String WX_MCHID;
    public static String WX_NOTIFYPATH;



    @Override
    public void afterPropertiesSet() throws Exception {
        WX_GATEWAY = gateway;
        WX_APPID = appid;
        WX_TYPE = type;
        WX_APPSECRET = appsecret;
        WX_MCHID = mchid;
        WX_NOTIFYPATH = notifyPath;

    }
}
